package com.cyou.gamehistory.trigger;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.cyou.annals.bean.GameInfo;
import com.cyou.annals.util.AnnalsClient;
import com.cyou.gamehistory.service.GameService;


/**
 * 同步游戏数据（定时）
 * @author wangzhang
 * date 2012-12-19 下午5:08:06
 */
public class SynchronizeGameInfo {
	static final Logger logger = LoggerFactory.getLogger(SynchronizeGameInfo.class);
	@Autowired
	private GameService gameService;
	public void synchronizeGame(){
		boolean isDebug = false;
		logger.info("获取游戏数据begin    AnnalsClient.getGameList(isDebug)     begin");
		List<GameInfo> list = AnnalsClient.getGameList(isDebug);
		logger.info("获取游戏数据end    AnnalsClient.getGameList(isDebug)     end");
		logger.info("开始同步数据begin    gameService.saveGameInfoBatch(list);     begin");
		gameService.saveGameInfoBatch(list);
		logger.info("同步数据end    gameService.saveGameInfoBatch(list);     end");
	}
	public static void main(String[] args) {
		boolean isDebug = false;
		List<GameInfo> list = AnnalsClient.getGameList(isDebug);
		System.out.println(list.get(0).getName());
	}
	

}
